<%-- 
    Document   : Admin
    Created on : 2020-4-20, 18:32:02
    Author     : zhang
--%>

<%@page import="dao.BookDao"%>
<%@page import="entity.Book"%>
<%@page import="java.util.List"%>
<%@page import="entity.Member"%>
<%@page import="dao.MemberDao"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <h1>管理界面</h1>
        <div style="position:absolute;left:500px;top:50px">
                <h3><a href="index">退出</a></h3>
            </div>
        <h2>用户列表</h2>
        <form action="UserSearchResult.jsp">
            <input type="text" name="keyword">&nbsp;
            <button>搜索用户信息</button>
        </form>
        <%
            List<Member> list=new MemberDao().getAllMember();
        %>
        <table>
            <tr><th>姓名</th><th>性别</th><th>手机号</th></tr>
            <%
                for(Member member:list){
            %>
            <tr><td><%=member.getName()%></td><td><%=member.getGender()%></td>
                <td><%=member.getPhone()%></td>
                <td><a href="MemberInfo.jsp?userid=<%=member.getId()%>">查看详情</a></td>
                <%
                    if(member.getIsForbid()==false){
                %>
                <td><a href="fus?userid=<%=member.getId()%>&type=1">禁用此用户</a></td></tr>
            <%
                }else{
            %>
                <td><a href="fus?userid=<%=member.getId()%>&type=2">解禁用户</a></td></tr>
        
            <%
                    }
            }
            %>
           
        </table>
        <h2>图书列表</h2>
        <h3><a href="AddBook.jsp">添加图书信息</a></h3>
        <form action="SearchBookInfoResult.jsp">
            <input type="text" name="keyword">&nbsp;
            <button>搜索图书信息</button>
        </form>
        <table>
            <tr><th>书名</th><th>作者</th><th>出版社</th><th>编号</th><th>类型</th></tr>
        <%
            List<Book> list1=new BookDao().getAllUndeletedBook();
            for(Book book:list1){
        %>
            <tr><td><%=book.getBookName()%></td><td><%=book.getAuthor()%></td><td><%=book.getPublishHouse()%></td><td><%=book.getId()%></td><td><%=book.getType()%></td>
                <td><a href="BookInfo.jsp?bookid=<%=book.getId()%>" target="blank">查看详情</a></td>
                <td><a href="dbs?bookid=<%=book.getId()%>">删除图书</a></td></tr>
            <%
                }
%></table>
    </body>
</html>
